﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace ActiveStory.UI
{
    public class PathValidationRule : ValidationRule
    {
        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {
            String path = (String)value;
            foreach (char currentChar in System.IO.Path.GetInvalidPathChars())
            {
                if (path.Contains(currentChar))
                    return new ValidationResult(false, "Invalid character: " + currentChar);
            }
            return new ValidationResult(true, null);
        }
    }
}
